/*
题目链接:https://leetcode.cn/problems/partition-equal-subset-sum/submissions/619753688/?envType=daily-question&envId=2025-04-07
*/

//题解代码:

class Solution {
public:
    bool canPartition(vector<int>& nums) {
        int s = accumulate(nums.begin(),nums.end(),0);
        if(s&1) return false;
        s /= 2;
        bitset<10001> f;
        f[0] = true;
        for(auto& x : nums){
            f |= f<<x;
        }
        return f[s];
    }
};
